import { get, post, put, del } from '@/utils/request'
import type { Column } from 'element-plus';

export const save = async (data: any) => {
    try {
        const response = await post<any>('/accounting/save', data);
        return response;
    } catch (error) {
    }
};

export const listByYearMonth = async (data: any) => {
    try {
        const response = await post<any>('/accounting/listByYearMonth', data);
        return response;
    } catch (error) {
    }
};
export const deleteAccounting = async (data: any) => {
    try {
        const response = await post<any>('/accounting/delete', data);
        return response;
    } catch (error) {
    }
};
export const yearSummary = async (data: any) => {
    try {
        const response = await post<any>('/accounting/yearSummary', data);
        return response;
    } catch (error) {
    }
};
export const monthSummary = async (data: any) => {
    try {
        const response = await post<any>('/accounting/monthSummary', data);
        return response;
    } catch (error) {
    }
};


export interface Accounting {
    id: number | null,
    // 记账年份
    accountingYear: number | null,
    // 记账月份
    accountingMonth: number | null,
    // 餐饮
    catering: number | null,
    cateringRemark: string | null,
    // 日常购物
    dailyShopping: number | null,
    dailyShoppingRemark: string | null,
    // 宝宝购物
    babyShopping: number | null,
    babyShoppingRemark: string | null,
    // 水电煤
    waterElectricityGas: number | null,
    waterElectricityGasRemark: string | null,
    // 车
    car: number | null,
    carRemark: string | null,
    // 手机
    phone: number | null,
    phoneRemark: string | null,
    // 出行
    travel: number | null,
    travelRemark: string | null,
    // 医疗
    healthcare: number | null,
    healthcareRemark: string | null,
    // 人情礼物
    humanGift: number | null,
    humanGiftRemark: string | null,
    // 其他
    others: number | null,
    othersRemark: string | null,
}
export interface AccountingRequest {
    id: number | null,
    coverFileId: number,
    fileIdList: number[],
}
export interface QueryParams {
    // 记账年份
    accountingYear: number | null,
    // 记账月份
    accountingMonth: number | null,
}
export interface PageData {
    // 总条数
    totalNum: number,
    tableData: Accounting[]
}
// 定义textList的每个元素的类型
export interface MenuItem {
    icon: string;
    text: string;
    fnn: (val: MenuItem) => void; // fnn是一个回调函数，参数类型可以根据实际情况定义
    params: {
        row: Accounting;  // row类型可以根据实际情况调整
        column: Column;   // column类型可以根据实际情况调整
        event: MouseEvent;
    };
}
// 定义clickXY对象的类型
export interface ClickXY {
    position: {
        x: number;
        y: number;
    };
}
export interface QuerySummaryParams {
    accountingYear: number | null,
    accountingMonth: number | null,
}
export interface AccountingSummaryVo {
    xseries: string[],
    yseries: number[],
}
